﻿using System;

namespace SharePointCompilationUtil
{
    class SpVer
    {
        /// <summary>
        /// Version of SharePoint compiled against - as integer
        /// (Note: Not necessarily the same as the version of the local farm)
        /// </summary>
        public static int SpVerNumber
        {
            get
            {
#if SP2007
                return 2007;
#elif SP2010

                return 2010;
#elif SP2013
                return 2013;
#else
                return 0;
#endif
            }
        }
        /// <summary>
        /// Version of SharePoint compiled against - as string
        /// (Note: Not necessarily the same as the version of the local farm)
        /// </summary>
        public static string SpVerString
        {
            get
            {
                int spver = SpVerNumber;
                if (spver == 0) return "?";
                return spver.ToString();
            }
        }
        /// <summary>
        /// Version of SharePoint compiled against, as 12/14/15 version number
        /// (Note: Not necessarily the same as the version of the local farm)
        /// </summary>
        public static int SpHiveNumber
        {
            get
            {
                switch (SpVerNumber)
                {
                    case 2007: return 12;
                    case 2010: return 14;
                    case 2013: return 15;
                    default: return 0;
                }
            }
        }
    }
}
